// import request from 'umi-request';
import request from '@/utils/request';
export async function queryRule(params) {
  const limit = params.pageSize;
  const page = params.current;
  const my_params = {
    limit: limit,
    page: page,
  };
  Object.assign(params, my_params);
  delete params.current;
  delete params.pageSize;
  return request('role/page', {
    params,
  });
}
export async function queryResource(params) {
  return request(`role/${params}`);
}
export async function queryTree(params) {
  return request('resource/list', {
    params,
  });
}
export async function removeRule(params) {
  return request(`role/${params}`, {
    method: 'DELETE',
  });
}
export async function addRule(params) {
  return request('role', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}
export async function updateRule(params) {
  return request('role', {
    method: 'PUT',
    data: {
      ...params,
    },
  });
}
